<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: yahoo   Lang.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>YAHOO Global&nbsp; <span class="subtitle">2.7.0</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_yahoo.html" title="yahoo">yahoo</a>
                
                 &gt; Lang.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
<div class="highlight" ><pre><span class="c">/**</span>
<span class="c"> * Provides the language utilites and extensions used by the library</span>
<span class="c"> * @class YAHOO.lang</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span> <span class="o">||</span> <span class="o">{};</span>

<span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>


<span class="k">var</span> <span class="nx">L</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">,</span>

    <span class="nx">ARRAY_TOSTRING</span> <span class="o">=</span> <span class="s1">&#39;[object Array]&#39;</span><span class="o">,</span>
    <span class="nx">FUNCTION_TOSTRING</span> <span class="o">=</span> <span class="s1">&#39;[object Function]&#39;</span><span class="o">,</span>
    <span class="nx">OP</span> <span class="o">=</span> <span class="nb">Object</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span>

    <span class="c">// ADD = [&quot;toString&quot;, &quot;valueOf&quot;, &quot;hasOwnProperty&quot;],</span>
<span class="c"></span>    <span class="nx">ADD</span> <span class="o">=</span> <span class="o">[</span><span class="s2">&quot;toString&quot;</span><span class="o">,</span> <span class="s2">&quot;valueOf&quot;</span><span class="o">],</span>

    <span class="nx">OB</span> <span class="o">=</span> <span class="o">{</span>

    <span class="c">/**</span>
<span class="c">     * Determines wheather or not the provided object is an array.</span>
<span class="c">     * @method isArray</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isArray</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span> 
        <span class="k">return</span> <span class="nx">OP</span><span class="o">.</span><span class="nx">toString</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">===</span> <span class="nx">ARRAY_TOSTRING</span><span class="o">;</span>
    <span class="o">},</span>

    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a boolean</span>
<span class="c">     * @method isBoolean</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isBoolean</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">o</span> <span class="o">===</span> <span class="s1">&#39;boolean&#39;</span><span class="o">;</span>
    <span class="o">},</span>
    
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a function.</span>
<span class="c">     * Note: Internet Explorer thinks certain functions are objects:</span>
<span class="c">     *</span>
<span class="c">     * var obj = document.createElement(&quot;object&quot;);</span>
<span class="c">     * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE</span>
<span class="c">     *</span>
<span class="c">     * var input = document.createElement(&quot;input&quot;); // append to body</span>
<span class="c">     * YAHOO.lang.isFunction(input.focus) // reports false in IE</span>
<span class="c">     *</span>
<span class="c">     * You will have to implement additional tests if these functions</span>
<span class="c">     * matter to you.</span>
<span class="c">     *</span>
<span class="c">     * @method isFunction</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isFunction</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">OP</span><span class="o">.</span><span class="nx">toString</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">===</span> <span class="nx">FUNCTION_TOSTRING</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is null</span>
<span class="c">     * @method isNull</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isNull</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">o</span> <span class="o">===</span> <span class="kc">null</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a legal number</span>
<span class="c">     * @method isNumber</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isNumber</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">o</span> <span class="o">===</span> <span class="s1">&#39;number&#39;</span> <span class="o">&amp;&amp;</span> <span class="nb">isFinite</span><span class="o">(</span><span class="nx">o</span><span class="o">);</span>
    <span class="o">},</span>
      
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is of type object</span>
<span class="c">     * or function</span>
<span class="c">     * @method isObject</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>  
    <span class="nx">isObject</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
<span class="k">return</span> <span class="o">(</span><span class="nx">o</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">o</span> <span class="o">===</span> <span class="s1">&#39;object&#39;</span> <span class="o">||</span> <span class="nx">L</span><span class="o">.</span><span class="nx">isFunction</span><span class="o">(</span><span class="nx">o</span><span class="o">)))</span> <span class="o">||</span> <span class="kc">false</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a string</span>
<span class="c">     * @method isString</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isString</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">o</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is undefined</span>
<span class="c">     * @method isUndefined</span>
<span class="c">     * @param {any} o The object being testing</span>
<span class="c">     * @return {boolean} the result</span>
<span class="c">     */</span>
    <span class="nx">isUndefined</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">o</span> <span class="o">===</span> <span class="s1">&#39;undefined&#39;</span><span class="o">;</span>
    <span class="o">},</span>
    
 
    <span class="c">/**</span>
<span class="c">     * IE will not enumerate native functions in a derived object even if the</span>
<span class="c">     * function was overridden.  This is a workaround for specific functions </span>
<span class="c">     * we care about on the Object prototype. </span>
<span class="c">     * @property _IEEnumFix</span>
<span class="c">     * @param {Function} r  the object to receive the augmentation</span>
<span class="c">     * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c">     * @static</span>
<span class="c">     * @private</span>
<span class="c">     */</span>
    <span class="nx">_IEEnumFix</span><span class="o">:</span> <span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">ua</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">?</span> <span class="k">function</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">fname</span><span class="o">,</span> <span class="nx">f</span><span class="o">;</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">ADD</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">fname</span> <span class="o">=</span> <span class="nx">ADD</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
                <span class="nx">f</span> <span class="o">=</span> <span class="nx">s</span><span class="o">[</span><span class="nx">fname</span><span class="o">];</span>

                <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isFunction</span><span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="nx">f</span><span class="o">!=</span><span class="nx">OP</span><span class="o">[</span><span class="nx">fname</span><span class="o">])</span> <span class="o">{</span>
                    <span class="nx">r</span><span class="o">[</span><span class="nx">fname</span><span class="o">]=</span><span class="nx">f</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
    <span class="o">}</span> <span class="o">:</span> <span class="k">function</span><span class="o">(){},</span>
       
    <span class="c">/**</span>
<span class="c">     * Utility to set up the prototype, constructor and superclass properties to</span>
<span class="c">     * support an inheritance strategy that can chain constructors and methods.</span>
<span class="c">     * Static members will not be inherited.</span>
<span class="c">     *</span>
<span class="c">     * @method extend</span>
<span class="c">     * @static</span>
<span class="c">     * @param {Function} subc   the object to modify</span>
<span class="c">     * @param {Function} superc the object to inherit</span>
<span class="c">     * @param {Object} overrides  additional properties/methods to add to the</span>
<span class="c">     *                              subclass prototype.  These will override the</span>
<span class="c">     *                              matching items obtained from the superclass </span>
<span class="c">     *                              if present.</span>
<span class="c">     */</span>
    <span class="nx">extend</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">subc</span><span class="o">,</span> <span class="nx">superc</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(!</span><span class="nx">superc</span><span class="o">||!</span><span class="nx">subc</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="o">(</span><span class="s2">&quot;extend failed, please check that &quot;</span> <span class="o">+</span>
                            <span class="s2">&quot;all dependencies are included.&quot;</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">var</span> <span class="nx">F</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{},</span> <span class="nx">i</span><span class="o">;</span>
        <span class="nx">F</span><span class="o">.</span><span class="nx">prototype</span><span class="o">=</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">;</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">=</span><span class="k">new</span> <span class="nx">F</span><span class="o">();</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span><span class="o">=</span><span class="nx">subc</span><span class="o">;</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">superclass</span><span class="o">=</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">;</span>
        <span class="k">if</span> <span class="o">(</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span> <span class="o">==</span> <span class="nx">OP</span><span class="o">.</span><span class="nx">constructor</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span><span class="o">=</span><span class="nx">superc</span><span class="o">;</span>
        <span class="o">}</span>
    
        <span class="k">if</span> <span class="o">(</span><span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">overrides</span><span class="o">,</span> <span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
                    <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">[</span><span class="nx">i</span><span class="o">]=</span><span class="nx">overrides</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
                <span class="o">}</span>
            <span class="o">}</span>

            <span class="nx">L</span><span class="o">.</span><span class="nx">_IEEnumFix</span><span class="o">(</span><span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">},</span>
   
    <span class="c">/**</span>
<span class="c">     * Applies all properties in the supplier to the receiver if the</span>
<span class="c">     * receiver does not have these properties yet.  Optionally, one or </span>
<span class="c">     * more methods/properties can be specified (as additional </span>
<span class="c">     * parameters).  This option will overwrite the property if receiver </span>
<span class="c">     * has it already.  If true is passed as the third parameter, all </span>
<span class="c">     * properties will be applied and _will_ overwrite properties in </span>
<span class="c">     * the receiver.</span>
<span class="c">     *</span>
<span class="c">     * @method augmentObject</span>
<span class="c">     * @static</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param {Function} r  the object to receive the augmentation</span>
<span class="c">     * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c">     * @param {String*|boolean}  arguments zero or more properties methods </span>
<span class="c">     *        to augment the receiver with.  If none specified, everything</span>
<span class="c">     *        in the supplier will be used unless it would</span>
<span class="c">     *        overwrite an existing property in the receiver. If true</span>
<span class="c">     *        is specified as the third parameter, all properties will</span>
<span class="c">     *        be applied and will overwrite an existing property in</span>
<span class="c">     *        the receiver</span>
<span class="c">     */</span>
    <span class="nx">augmentObject</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(!</span><span class="nx">s</span><span class="o">||!</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="o">(</span><span class="s2">&quot;Absorb failed, verify dependencies.&quot;</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">var</span> <span class="nx">a</span><span class="o">=</span><span class="nx">arguments</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">p</span><span class="o">,</span> <span class="nx">overrideList</span><span class="o">=</span><span class="nx">a</span><span class="o">[</span><span class="m">2</span><span class="o">];</span>
        <span class="k">if</span> <span class="o">(</span><span class="nx">overrideList</span> <span class="o">&amp;&amp;</span> <span class="nx">overrideList</span><span class="o">!==</span><span class="kc">true</span><span class="o">)</span> <span class="o">{</span> <span class="c">// only absorb the specified properties</span>
<span class="c"></span>            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">2</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">a</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">r</span><span class="o">[</span><span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">]]</span> <span class="o">=</span> <span class="nx">s</span><span class="o">[</span><span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">]];</span>
            <span class="o">}</span>
        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span> <span class="c">// take everything, overwriting only if the third parameter is true</span>
<span class="c"></span>            <span class="k">for</span> <span class="o">(</span><span class="nx">p</span> <span class="k">in</span> <span class="nx">s</span><span class="o">)</span> <span class="o">{</span> 
                <span class="k">if</span> <span class="o">(</span><span class="nx">overrideList</span> <span class="o">||</span> <span class="o">!(</span><span class="nx">p</span> <span class="k">in</span> <span class="nx">r</span><span class="o">))</span> <span class="o">{</span>
                    <span class="nx">r</span><span class="o">[</span><span class="nx">p</span><span class="o">]</span> <span class="o">=</span> <span class="nx">s</span><span class="o">[</span><span class="nx">p</span><span class="o">];</span>
                <span class="o">}</span>
            <span class="o">}</span>
            
            <span class="nx">L</span><span class="o">.</span><span class="nx">_IEEnumFix</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">s</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">},</span>
 
    <span class="c">/**</span>
<span class="c">     * Same as YAHOO.lang.augmentObject, except it only applies prototype properties</span>
<span class="c">     * @see YAHOO.lang.augmentObject</span>
<span class="c">     * @method augmentProto</span>
<span class="c">     * @static</span>
<span class="c">     * @param {Function} r  the object to receive the augmentation</span>
<span class="c">     * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c">     * @param {String*|boolean}  arguments zero or more properties methods </span>
<span class="c">     *        to augment the receiver with.  If none specified, everything </span>
<span class="c">     *        in the supplier will be used unless it would overwrite an existing </span>
<span class="c">     *        property in the receiver.  if true is specified as the third </span>
<span class="c">     *        parameter, all properties will be applied and will overwrite an </span>
<span class="c">     *        existing property in the receiver</span>
<span class="c">     */</span>
    <span class="nx">augmentProto</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(!</span><span class="nx">s</span><span class="o">||!</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="o">(</span><span class="s2">&quot;Augment failed, verify dependencies.&quot;</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="c">//var a=[].concat(arguments);</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">a</span><span class="o">=[</span><span class="nx">r</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span><span class="nx">s</span><span class="o">.</span><span class="nx">prototype</span><span class="o">],</span> <span class="nx">i</span><span class="o">;</span>
        <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">2</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">arguments</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">a</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">arguments</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
        <span class="o">}</span>
        <span class="nx">L</span><span class="o">.</span><span class="nx">augmentObject</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">a</span><span class="o">);</span>
    <span class="o">},</span>

      
    <span class="c">/**</span>
<span class="c">     * Returns a simple string representation of the object or array.</span>
<span class="c">     * Other types of objects will be returned unprocessed.  Arrays</span>
<span class="c">     * are expected to be indexed.  Use object notation for</span>
<span class="c">     * associative arrays.</span>
<span class="c">     * @method dump</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param o {Object} The object to dump</span>
<span class="c">     * @param d {int} How deep to recurse child objects, default 3</span>
<span class="c">     * @return {String} the dump result</span>
<span class="c">     */</span>
    <span class="nx">dump</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">d</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">i</span><span class="o">,</span><span class="nx">len</span><span class="o">,</span><span class="nx">s</span><span class="o">=[],</span><span class="nx">OBJ</span><span class="o">=</span><span class="s2">&quot;{...}&quot;</span><span class="o">,</span><span class="nx">FUN</span><span class="o">=</span><span class="s2">&quot;f(){...}&quot;</span><span class="o">,</span>
            <span class="nx">COMMA</span><span class="o">=</span><span class="s1">&#39;, &#39;</span><span class="o">,</span> <span class="nx">ARROW</span><span class="o">=</span><span class="s1">&#39; =&gt; &#39;</span><span class="o">;</span>

        <span class="c">// Cast non-objects to string</span>
<span class="c"></span>        <span class="c">// Skip dates because the std toString is what we want</span>
<span class="c"></span>        <span class="c">// Skip HTMLElement-like objects because trying to dump </span>
<span class="c"></span>        <span class="c">// an element will cause an unhandled exception in FF 2.x</span>
<span class="c"></span>        <span class="k">if</span> <span class="o">(!</span><span class="nx">L</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">o</span><span class="o">))</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">o</span> <span class="o">+</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
        <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">o</span> <span class="k">instanceof</span> <span class="nb">Date</span> <span class="o">||</span> <span class="o">(</span><span class="s2">&quot;nodeType&quot;</span> <span class="k">in</span> <span class="nx">o</span> <span class="o">&amp;&amp;</span> <span class="s2">&quot;tagName&quot;</span> <span class="k">in</span> <span class="nx">o</span><span class="o">))</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
        <span class="o">}</span> <span class="k">else</span> <span class="k">if</span>  <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isFunction</span><span class="o">(</span><span class="nx">o</span><span class="o">))</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">FUN</span><span class="o">;</span>
        <span class="o">}</span>

        <span class="c">// dig into child objects the depth specifed. Default 3</span>
<span class="c"></span>        <span class="nx">d</span> <span class="o">=</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">(</span><span class="nx">d</span><span class="o">))</span> <span class="o">?</span> <span class="nx">d</span> <span class="o">:</span> <span class="m">3</span><span class="o">;</span>

        <span class="c">// arrays [1, 2, 3]</span>
<span class="c"></span>        <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">o</span><span class="o">))</span> <span class="o">{</span>
            <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="s2">&quot;[&quot;</span><span class="o">);</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">,</span><span class="nx">len</span><span class="o">=</span><span class="nx">o</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="o">;</span><span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]))</span> <span class="o">{</span>
                    <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">((</span><span class="nx">d</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">?</span> <span class="nx">L</span><span class="o">.</span><span class="nx">dump</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="nx">d</span><span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">:</span> <span class="nx">OBJ</span><span class="o">);</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
                <span class="o">}</span>
                <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">COMMA</span><span class="o">);</span>
            <span class="o">}</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">s</span><span class="o">.</span><span class="nx">pop</span><span class="o">();</span>
            <span class="o">}</span>
            <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="s2">&quot;]&quot;</span><span class="o">);</span>
        <span class="c">// objects {k1 =&gt; v1, k2 =&gt; v2}</span>
<span class="c"></span>        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
            <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="s2">&quot;{&quot;</span><span class="o">);</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
                    <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">i</span> <span class="o">+</span> <span class="nx">ARROW</span><span class="o">);</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]))</span> <span class="o">{</span>
                        <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">((</span><span class="nx">d</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">?</span> <span class="nx">L</span><span class="o">.</span><span class="nx">dump</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="nx">d</span><span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">:</span> <span class="nx">OBJ</span><span class="o">);</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
                    <span class="o">}</span>
                    <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">COMMA</span><span class="o">);</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">s</span><span class="o">.</span><span class="nx">pop</span><span class="o">();</span>
            <span class="o">}</span>
            <span class="nx">s</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="s2">&quot;}&quot;</span><span class="o">);</span>
        <span class="o">}</span>

        <span class="k">return</span> <span class="nx">s</span><span class="o">.</span><span class="nx">join</span><span class="o">(</span><span class="s2">&quot;&quot;</span><span class="o">);</span>
    <span class="o">},</span>

    <span class="c">/**</span>
<span class="c">     * Does variable substitution on a string. It scans through the string </span>
<span class="c">     * looking for expressions enclosed in { } braces. If an expression </span>
<span class="c">     * is found, it is used a key on the object.  If there is a space in</span>
<span class="c">     * the key, the first word is used for the key and the rest is provided</span>
<span class="c">     * to an optional function to be used to programatically determine the</span>
<span class="c">     * value (the extra information might be used for this decision). If </span>
<span class="c">     * the value for the key in the object, or what is returned from the</span>
<span class="c">     * function has a string value, number value, or object value, it is </span>
<span class="c">     * substituted for the bracket expression and it repeats.  If this</span>
<span class="c">     * value is an object, it uses the Object&#39;s toString() if this has</span>
<span class="c">     * been overridden, otherwise it does a shallow dump of the key/value</span>
<span class="c">     * pairs.</span>
<span class="c">     * @method substitute</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param s {String} The string that will be modified.</span>
<span class="c">     * @param o {Object} An object containing the replacement values</span>
<span class="c">     * @param f {Function} An optional function that can be used to</span>
<span class="c">     *                     process each match.  It receives the key,</span>
<span class="c">     *                     value, and any extra metadata included with</span>
<span class="c">     *                     the key inside of the braces.</span>
<span class="c">     * @return {String} the substituted string</span>
<span class="c">     */</span>
    <span class="nx">substitute</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">s</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">k</span><span class="o">,</span> <span class="nx">key</span><span class="o">,</span> <span class="nx">v</span><span class="o">,</span> <span class="nx">meta</span><span class="o">,</span> <span class="nx">saved</span><span class="o">=[],</span> <span class="nx">token</span><span class="o">,</span> 
            <span class="nx">DUMP</span><span class="o">=</span><span class="s1">&#39;dump&#39;</span><span class="o">,</span> <span class="nx">SPACE</span><span class="o">=</span><span class="s1">&#39; &#39;</span><span class="o">,</span> <span class="nx">LBRACE</span><span class="o">=</span><span class="s1">&#39;{&#39;</span><span class="o">,</span> <span class="nx">RBRACE</span><span class="o">=</span><span class="s1">&#39;}&#39;</span><span class="o">,</span>
            <span class="nx">dump</span><span class="o">;</span>


        <span class="k">for</span> <span class="o">(;;)</span> <span class="o">{</span>
            <span class="nx">i</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">lastIndexOf</span><span class="o">(</span><span class="nx">LBRACE</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">i</span> <span class="o">&lt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">break</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="nx">j</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">RBRACE</span><span class="o">,</span> <span class="nx">i</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">i</span> <span class="o">+</span> <span class="m">1</span> <span class="o">&gt;=</span> <span class="nx">j</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">break</span><span class="o">;</span>
            <span class="o">}</span>

            <span class="c">//Extract key and meta info </span>
<span class="c"></span>            <span class="nx">token</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="nx">i</span> <span class="o">+</span> <span class="m">1</span><span class="o">,</span> <span class="nx">j</span><span class="o">);</span>
            <span class="nx">key</span> <span class="o">=</span> <span class="nx">token</span><span class="o">;</span>
            <span class="nx">meta</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
            <span class="nx">k</span> <span class="o">=</span> <span class="nx">key</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">SPACE</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">k</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">meta</span> <span class="o">=</span> <span class="nx">key</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="nx">k</span> <span class="o">+</span> <span class="m">1</span><span class="o">);</span>
                <span class="nx">key</span> <span class="o">=</span> <span class="nx">key</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="nx">k</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="c">// lookup the value</span>
<span class="c"></span>            <span class="nx">v</span> <span class="o">=</span> <span class="nx">o</span><span class="o">[</span><span class="nx">key</span><span class="o">];</span>

            <span class="c">// if a substitution function was provided, execute it</span>
<span class="c"></span>            <span class="k">if</span> <span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">v</span> <span class="o">=</span> <span class="nx">f</span><span class="o">(</span><span class="nx">key</span><span class="o">,</span> <span class="nx">v</span><span class="o">,</span> <span class="nx">meta</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">v</span><span class="o">))</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">v</span><span class="o">))</span> <span class="o">{</span>
                    <span class="nx">v</span> <span class="o">=</span> <span class="nx">L</span><span class="o">.</span><span class="nx">dump</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">meta</span><span class="o">,</span> <span class="m">10</span><span class="o">));</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">meta</span> <span class="o">=</span> <span class="nx">meta</span> <span class="o">||</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>

                    <span class="c">// look for the keyword &#39;dump&#39;, if found force obj dump</span>
<span class="c"></span>                    <span class="nx">dump</span> <span class="o">=</span> <span class="nx">meta</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">DUMP</span><span class="o">);</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">dump</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">meta</span> <span class="o">=</span> <span class="nx">meta</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="m">4</span><span class="o">);</span>
                    <span class="o">}</span>

                    <span class="c">// use the toString if it is not the Object toString </span>
<span class="c"></span>                    <span class="c">// and the &#39;dump&#39; meta info was not found</span>
<span class="c"></span>                    <span class="k">if</span> <span class="o">(</span><span class="nx">v</span><span class="o">.</span><span class="nx">toString</span><span class="o">===</span><span class="nx">OP</span><span class="o">.</span><span class="nx">toString</span> <span class="o">||</span> <span class="nx">dump</span><span class="o">&gt;-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">v</span> <span class="o">=</span> <span class="nx">L</span><span class="o">.</span><span class="nx">dump</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">meta</span><span class="o">,</span> <span class="m">10</span><span class="o">));</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">v</span> <span class="o">=</span> <span class="nx">v</span><span class="o">.</span><span class="nx">toString</span><span class="o">();</span>
                    <span class="o">}</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(!</span><span class="nx">L</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">v</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">L</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">(</span><span class="nx">v</span><span class="o">))</span> <span class="o">{</span>
                <span class="c">// This {block} has no replace string. Save it for later.</span>
<span class="c"></span>                <span class="nx">v</span> <span class="o">=</span> <span class="s2">&quot;~-&quot;</span> <span class="o">+</span> <span class="nx">saved</span><span class="o">.</span><span class="nx">length</span> <span class="o">+</span> <span class="s2">&quot;-~&quot;</span><span class="o">;</span>
                <span class="nx">saved</span><span class="o">[</span><span class="nx">saved</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">token</span><span class="o">;</span>

                <span class="c">// break;</span>
<span class="c"></span>            <span class="o">}</span>

            <span class="nx">s</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="nx">i</span><span class="o">)</span> <span class="o">+</span> <span class="nx">v</span> <span class="o">+</span> <span class="nx">s</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="nx">j</span> <span class="o">+</span> <span class="m">1</span><span class="o">);</span>


        <span class="o">}</span>

        <span class="c">// restore saved {block}s</span>
<span class="c"></span>        <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="nx">saved</span><span class="o">.</span><span class="nx">length</span><span class="o">-</span><span class="m">1</span><span class="o">;</span> <span class="nx">i</span><span class="o">&gt;=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">s</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="o">(</span><span class="s2">&quot;~-&quot;</span> <span class="o">+</span> <span class="nx">i</span> <span class="o">+</span> <span class="s2">&quot;-~&quot;</span><span class="o">),</span> <span class="s2">&quot;{&quot;</span>  <span class="o">+</span> <span class="nx">saved</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">+</span> <span class="s2">&quot;}&quot;</span><span class="o">,</span> <span class="s2">&quot;g&quot;</span><span class="o">);</span>
        <span class="o">}</span>

        <span class="k">return</span> <span class="nx">s</span><span class="o">;</span>
    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">     * Returns a string without any leading or trailing whitespace.  If </span>
<span class="c">     * the input is not a string, the input will be returned untouched.</span>
<span class="c">     * @method trim</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param s {string} the string to trim</span>
<span class="c">     * @return {string} the trimmed string</span>
<span class="c">     */</span>
    <span class="nx">trim</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">s</span><span class="o">){</span>
        <span class="k">try</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">s</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="sr">/^\s+|\s+$/g</span><span class="o">,</span> <span class="s2">&quot;&quot;</span><span class="o">);</span>
        <span class="o">}</span> <span class="k">catch</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">s</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">},</span>

    <span class="c">/**</span>
<span class="c">     * Returns a new object containing all of the properties of</span>
<span class="c">     * all the supplied objects.  The properties from later objects</span>
<span class="c">     * will overwrite those in earlier objects.</span>
<span class="c">     * @method merge</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param arguments {Object*} the objects to merge</span>
<span class="c">     * @return the new merged object</span>
<span class="c">     */</span>
    <span class="nx">merge</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">o</span><span class="o">={},</span> <span class="nx">a</span><span class="o">=</span><span class="nx">arguments</span><span class="o">,</span> <span class="nx">l</span><span class="o">=</span><span class="nx">a</span><span class="o">.</span><span class="nx">length</span><span class="o">,</span> <span class="nx">i</span><span class="o">;</span>
        <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">l</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">L</span><span class="o">.</span><span class="nx">augmentObject</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="kc">true</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
    <span class="o">},</span>

    <span class="c">/**</span>
<span class="c">     * Executes the supplied function in the context of the supplied </span>
<span class="c">     * object &#39;when&#39; milliseconds later.  Executes the function a </span>
<span class="c">     * single time unless periodic is set to true.</span>
<span class="c">     * @method later</span>
<span class="c">     * @since 2.4.0</span>
<span class="c">     * @param when {int} the number of milliseconds to wait until the fn </span>
<span class="c">     * is executed</span>
<span class="c">     * @param o the context object</span>
<span class="c">     * @param fn {Function|String} the function to execute or the name of </span>
<span class="c">     * the method in the &#39;o&#39; object to execute</span>
<span class="c">     * @param data [Array] data that is provided to the function.  This accepts</span>
<span class="c">     * either a single item or an array.  If an array is provided, the</span>
<span class="c">     * function is executed with one parameter for each array item.  If</span>
<span class="c">     * you need to pass a single array parameter, it needs to be wrapped in</span>
<span class="c">     * an array [myarray]</span>
<span class="c">     * @param periodic {boolean} if true, executes continuously at supplied </span>
<span class="c">     * interval until canceled</span>
<span class="c">     * @return a timer object. Call the cancel() method on this object to </span>
<span class="c">     * stop the timer.</span>
<span class="c">     */</span>
    <span class="nx">later</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">when</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">fn</span><span class="o">,</span> <span class="nx">data</span><span class="o">,</span> <span class="nx">periodic</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">when</span> <span class="o">=</span> <span class="nx">when</span> <span class="o">||</span> <span class="m">0</span><span class="o">;</span> 
        <span class="nx">o</span> <span class="o">=</span> <span class="nx">o</span> <span class="o">||</span> <span class="o">{};</span>
        <span class="k">var</span> <span class="nx">m</span><span class="o">=</span><span class="nx">fn</span><span class="o">,</span> <span class="nx">d</span><span class="o">=</span><span class="nx">data</span><span class="o">,</span> <span class="nx">f</span><span class="o">,</span> <span class="nx">r</span><span class="o">;</span>

        <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">fn</span><span class="o">))</span> <span class="o">{</span>
            <span class="nx">m</span> <span class="o">=</span> <span class="nx">o</span><span class="o">[</span><span class="nx">fn</span><span class="o">];</span>
        <span class="o">}</span>

        <span class="k">if</span> <span class="o">(!</span><span class="nx">m</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nx">TypeError</span><span class="o">(</span><span class="s2">&quot;method undefined&quot;</span><span class="o">);</span>
        <span class="o">}</span>

        <span class="k">if</span> <span class="o">(!</span><span class="nx">L</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">d</span><span class="o">))</span> <span class="o">{</span>
            <span class="nx">d</span> <span class="o">=</span> <span class="o">[</span><span class="nx">data</span><span class="o">];</span>
        <span class="o">}</span>

        <span class="nx">f</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="nx">m</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">d</span><span class="o">);</span>
        <span class="o">};</span>

        <span class="nx">r</span> <span class="o">=</span> <span class="o">(</span><span class="nx">periodic</span><span class="o">)</span> <span class="o">?</span> <span class="nx">setInterval</span><span class="o">(</span><span class="nx">f</span><span class="o">,</span> <span class="nx">when</span><span class="o">)</span> <span class="o">:</span> <span class="nx">setTimeout</span><span class="o">(</span><span class="nx">f</span><span class="o">,</span> <span class="nx">when</span><span class="o">);</span>

        <span class="k">return</span> <span class="o">{</span>
            <span class="nx">interval</span><span class="o">:</span> <span class="nx">periodic</span><span class="o">,</span>
            <span class="nx">cancel</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">interval</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">clearInterval</span><span class="o">(</span><span class="nx">r</span><span class="o">);</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">clearTimeout</span><span class="o">(</span><span class="nx">r</span><span class="o">);</span>
                <span class="o">}</span>
            <span class="o">}</span>
        <span class="o">};</span>
    <span class="o">},</span>
    
    <span class="c">/**</span>
<span class="c">     * A convenience method for detecting a legitimate non-null value.</span>
<span class="c">     * Returns false for null/undefined/NaN, true for other values, </span>
<span class="c">     * including 0/false/&#39;&#39;</span>
<span class="c">     * @method isValue</span>
<span class="c">     * @since 2.3.0</span>
<span class="c">     * @param o {any} the item to test</span>
<span class="c">     * @return {boolean} true if it is not null/undefined/NaN || false</span>
<span class="c">     */</span>
    <span class="nx">isValue</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
        <span class="c">// return (o || o === false || o === 0 || o === &#39;&#39;); // Infinity fails</span>
<span class="c"></span><span class="k">return</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">||</span> <span class="nx">L</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">||</span> <span class="nx">L</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">||</span> <span class="nx">L</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">(</span><span class="nx">o</span><span class="o">));</span>
    <span class="o">}</span>

<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Determines whether or not the property was added</span>
<span class="c"> * to the object instance.  Returns false if the property is not present</span>
<span class="c"> * in the object, or was inherited from the prototype.</span>
<span class="c"> * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.</span>
<span class="c"> * There is a discrepancy between YAHOO.lang.hasOwnProperty and</span>
<span class="c"> * Object.prototype.hasOwnProperty when the property is a primitive added to</span>
<span class="c"> * both the instance AND prototype with the same value:</span>
<span class="c"> * &lt;pre&gt;</span>
<span class="c"> * var A = function() {};</span>
<span class="c"> * A.prototype.foo = &#39;foo&#39;;</span>
<span class="c"> * var a = new A();</span>
<span class="c"> * a.foo = &#39;foo&#39;;</span>
<span class="c"> * alert(a.hasOwnProperty(&#39;foo&#39;)); // true</span>
<span class="c"> * alert(YAHOO.lang.hasOwnProperty(a, &#39;foo&#39;)); // false when using fallback</span>
<span class="c"> * &lt;/pre&gt;</span>
<span class="c"> * @method hasOwnProperty</span>
<span class="c"> * @param {any} o The object being testing</span>
<span class="c"> * @param prop {string} the name of the property to test</span>
<span class="c"> * @return {boolean} the result</span>
<span class="c"> */</span>
<span class="nx">L</span><span class="o">.</span><span class="nx">hasOwnProperty</span> <span class="o">=</span> <span class="o">(</span><span class="nx">OP</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">)</span> <span class="o">?</span>
    <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">prop</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">o</span> <span class="o">&amp;&amp;</span> <span class="nx">o</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">prop</span><span class="o">);</span>
    <span class="o">}</span> <span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">prop</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="o">!</span><span class="nx">L</span><span class="o">.</span><span class="nx">isUndefined</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">prop</span><span class="o">])</span> <span class="o">&amp;&amp;</span> 
                <span class="nx">o</span><span class="o">.</span><span class="nx">constructor</span><span class="o">.</span><span class="nx">prototype</span><span class="o">[</span><span class="nx">prop</span><span class="o">]</span> <span class="o">!==</span> <span class="nx">o</span><span class="o">[</span><span class="nx">prop</span><span class="o">];</span>
    <span class="o">};</span>

<span class="c">// new lang wins</span>
<span class="c"></span><span class="nx">OB</span><span class="o">.</span><span class="nx">augmentObject</span><span class="o">(</span><span class="nx">L</span><span class="o">,</span> <span class="nx">OB</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

<span class="c">/*</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html&quot;&gt;YAHOO.lang&lt;/a&gt;</span>
<span class="c"> * @class YAHOO.util.Lang</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Lang</span> <span class="o">=</span> <span class="nx">L</span><span class="o">;</span>
 
<span class="c">/**</span>
<span class="c"> * Same as YAHOO.lang.augmentObject, except it only applies prototype </span>
<span class="c"> * properties.  This is an alias for augmentProto.</span>
<span class="c"> * @see YAHOO.lang.augmentObject</span>
<span class="c"> * @method augment</span>
<span class="c"> * @static</span>
<span class="c"> * @param {Function} r  the object to receive the augmentation</span>
<span class="c"> * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c"> * @param {String*|boolean}  arguments zero or more properties methods to </span>
<span class="c"> *        augment the receiver with.  If none specified, everything</span>
<span class="c"> *        in the supplier will be used unless it would</span>
<span class="c"> *        overwrite an existing property in the receiver.  if true</span>
<span class="c"> *        is specified as the third parameter, all properties will</span>
<span class="c"> *        be applied and will overwrite an existing property in</span>
<span class="c"> *        the receiver</span>
<span class="c"> */</span>
<span class="nx">L</span><span class="o">.</span><span class="nx">augment</span> <span class="o">=</span> <span class="nx">L</span><span class="o">.</span><span class="nx">augmentProto</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html#augment&quot;&gt;YAHOO.lang.augment&lt;/a&gt;</span>
<span class="c"> * @for YAHOO</span>
<span class="c"> * @method augment</span>
<span class="c"> * @static</span>
<span class="c"> * @param {Function} r  the object to receive the augmentation</span>
<span class="c"> * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c"> * @param {String*}  arguments zero or more properties methods to </span>
<span class="c"> *        augment the receiver with.  If none specified, everything</span>
<span class="c"> *        in the supplier will be used unless it would</span>
<span class="c"> *        overwrite an existing property in the receiver</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">augment</span> <span class="o">=</span> <span class="nx">L</span><span class="o">.</span><span class="nx">augmentProto</span><span class="o">;</span>
       
<span class="c">/**</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html#extend&quot;&gt;YAHOO.lang.extend&lt;/a&gt;</span>
<span class="c"> * @method extend</span>
<span class="c"> * @static</span>
<span class="c"> * @param {Function} subc   the object to modify</span>
<span class="c"> * @param {Function} superc the object to inherit</span>
<span class="c"> * @param {Object} overrides  additional properties/methods to add to the</span>
<span class="c"> *        subclass prototype.  These will override the</span>
<span class="c"> *        matching items obtained from the superclass if present.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">extend</span> <span class="o">=</span> <span class="nx">L</span><span class="o">.</span><span class="nx">extend</span><span class="o">;</span>

<span class="o">})();</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_animation.html" title="animation">animation</a></li>
                                <li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
                                <li class=""><a href="module_button.html" title="button">button</a></li>
                                <li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
                                <li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
                                <li class=""><a href="module_charts.html" title="charts">charts</a></li>
                                <li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
                                <li class=""><a href="module_connection.html" title="connection">connection</a></li>
                                <li class=""><a href="module_container.html" title="container">container</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
                                <li class=""><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
                                <li class=""><a href="module_editor.html" title="editor">editor</a></li>
                                <li class=""><a href="module_element.html" title="element">element</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_get.html" title="get">get</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_layout.html" title="layout">layout</a></li>
                                <li class=""><a href="module_logger.html" title="logger">logger</a></li>
                                <li class=""><a href="module_menu.html" title="menu">menu</a></li>
                                <li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
                                <li class=""><a href="module_resize.html" title="resize">resize</a></li>
                                <li class=""><a href="module_selector.html" title="selector">selector</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
                                <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
                                <li class="selected"><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
                                <li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
                                <li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.html" title="YAHOO">YAHOO</a></li>
                                <li class=""><a href="YAHOO.env.html" title="YAHOO.env">YAHOO.env</a></li>
                                <li class=""><a href="YAHOO.env.ua.html" title="YAHOO.env.ua">YAHOO.env.ua</a></li>
                                <li class=""><a href="YAHOO.lang.html" title="YAHOO.lang">YAHOO.lang</a></li>
                                <li class=""><a href="YAHOO_config.html" title="YAHOO_config">YAHOO_config</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Env.js.html" title="Env.js">Env.js</a></li>
                                <li class="selected"><a href="Lang.js.html" title="Lang.js">Lang.js</a></li>
                                <li class=""><a href="YAHOO.js.html" title="YAHOO.js">YAHOO.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2009 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">
    ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.env.ua", "name": "air", "url": "YAHOO.env.ua.html#property_air", "type": "property"}, {"access": "", "host": "YAHOO.lang", "name": "augment", "url": "YAHOO.lang.html#method_augment", "type": "method"}, {"access": "", "host": "YAHOO", "name": "augment", "url": "YAHOO.html#method_augment", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "augmentObject", "url": "YAHOO.lang.html#method_augmentObject", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "augmentProto", "url": "YAHOO.lang.html#method_augmentProto", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "caja", "url": "YAHOO.env.ua.html#property_caja", "type": "property"}, {"access": "", "host": "YAHOO.lang", "name": "dump", "url": "YAHOO.lang.html#method_dump", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "extend", "url": "YAHOO.lang.html#method_extend", "type": "method"}, {"access": "", "host": "YAHOO", "name": "extend", "url": "YAHOO.html#method_extend", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "gecko", "url": "YAHOO.env.ua.html#property_gecko", "type": "property"}, {"access": "", "host": "YAHOO.env", "name": "getVersion", "url": "YAHOO.env.html#method_getVersion", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "hasOwnProperty", "url": "YAHOO.lang.html#method_hasOwnProperty", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "ie", "url": "YAHOO.env.ua.html#property_ie", "type": "property"}, {"access": "private", "host": "YAHOO.lang", "name": "_IEEnumFix", "url": "YAHOO.lang.html#property__IEEnumFix", "type": "property"}, {"access": "", "host": "YAHOO_config", "name": "injecting", "url": "YAHOO_config.html#property_injecting", "type": "property"}, {"access": "", "host": "YAHOO.lang", "name": "isArray", "url": "YAHOO.lang.html#method_isArray", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isBoolean", "url": "YAHOO.lang.html#method_isBoolean", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isFunction", "url": "YAHOO.lang.html#method_isFunction", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isNull", "url": "YAHOO.lang.html#method_isNull", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isNumber", "url": "YAHOO.lang.html#method_isNumber", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isObject", "url": "YAHOO.lang.html#method_isObject", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isString", "url": "YAHOO.lang.html#method_isString", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isUndefined", "url": "YAHOO.lang.html#method_isUndefined", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "isValue", "url": "YAHOO.lang.html#method_isValue", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "later", "url": "YAHOO.lang.html#method_later", "type": "method"}, {"access": "", "host": "YAHOO_config", "name": "listener", "url": "YAHOO_config.html#property_listener", "type": "property"}, {"access": "", "host": "YAHOO.env", "name": "listeners", "url": "YAHOO.env.html#property_listeners", "type": "property"}, {"access": "", "host": "YAHOO_config", "name": "load", "url": "YAHOO_config.html#property_load", "type": "property"}, {"access": "", "host": "YAHOO_config", "name": "locale", "url": "YAHOO_config.html#property_locale", "type": "property"}, {"access": "", "host": "YAHOO", "name": "log", "url": "YAHOO.html#method_log", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "merge", "url": "YAHOO.lang.html#method_merge", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "mobile", "url": "YAHOO.env.ua.html#property_mobile", "type": "property"}, {"access": "", "host": "YAHOO.env", "name": "modules", "url": "YAHOO.env.html#property_modules", "type": "property"}, {"access": "", "host": "YAHOO", "name": "namespace", "url": "YAHOO.html#method_namespace", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "opera", "url": "YAHOO.env.ua.html#property_opera", "type": "property"}, {"access": "", "host": "YAHOO", "name": "register", "url": "YAHOO.html#method_register", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "substitute", "url": "YAHOO.lang.html#method_substitute", "type": "method"}, {"access": "", "host": "YAHOO.lang", "name": "trim", "url": "YAHOO.lang.html#method_trim", "type": "method"}, {"access": "", "host": "YAHOO.env.ua", "name": "webkit", "url": "YAHOO.env.ua.html#property_webkit", "type": "property"}];
</script>
</body>
</html>
